package com.spic.business.vehicle.carInfo.service;

import com.alibaba.fastjson.JSONObject;
import com.spic.business.vehicle.carInfo.domain.CarInfoDto;
import com.spic.business.vehicle.carInfo.service.impl.XHBLCarInfoServiceImpl;
import com.spic.business.vehicle.carInfo.service.impl.XHSMCarInfoServiceImpl;
import com.spic.business.vehicle.carInfo.service.impl.ZYCLCarInfoServiceImpl;

import java.util.List;

/**
 * @author : 赵祥
 * create at:  2022/11/5  9:29
 * @Description : 环境类，用来操作不同的策略
 **/
public class CarInfoContext {
    private ICarInfoservice carInfoservice;

    public CarInfoContext(String carType) {
        switch (carType) {
            case "ZYCL":
                carInfoservice = new ZYCLCarInfoServiceImpl();
                break;
            case "XHSM":
                carInfoservice = new XHSMCarInfoServiceImpl();
                break;
            case "XHBL":
                carInfoservice = new XHBLCarInfoServiceImpl();
                break;
        }
    }

    public List<CarInfoDto> selectCarList() {
        return carInfoservice.selectCarList();
    }

    public JSONObject getUserMarkers() {
        return carInfoservice.getUserMarkers();
    }
}
